#!/bin/bash

set -e

export fc_component_runtime=python3
export fc_component_function_name=python3-$(uname)-$(uname -m)
echo "test python3 runtime ..."
rm -rf ./code/3rd-packages
s build
s local invoke -e '{"hello":"fc python3"}'
s deploy -y 
s info
s invoke -e '{"hello":"fc python3"}'
s remove -y

export fc_component_runtime=python3.10
export fc_component_function_name=python310-$(uname)-$(uname -m)
rm -rf ./code/3rd-packages
echo "test python3.10 runtime ..."
s build
s local invoke -e '{"hello":"fc python3.10"}'
s deploy -y 
s invoke -e '{"hello":"fc python3.10"}'
s remove -y

export fc_component_runtime=python3.9
export fc_component_function_name=python39-$(uname)-$(uname -m)
echo "test python3.9 runtime ..."
rm -rf ./code/3rd-packages
s build
s local invoke -e '{"hello":"fc python3.9"}'
s deploy -y 
s invoke -e '{"hello":"fc python3.9"}'
s remove -y

# export fc_component_runtime=python2.7
# export fc_component_function_name=python27-$(uname)-$(uname -m)
# echo "test python2.7 runtime ..."
# rm -rf ./code/3rd-packages
# s build
# s local invoke -e '{"hello":"fc python2.7"}'
# s deploy -y 
# s invoke -e '{"hello":"fc python2.7"}'
# s remove -y
